package cn.itcast.demo.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.HashSet;
import java.util.Set;

@ConfigurationProperties(prefix = "jdbc") //从指定的文件中读取固定的前缀
//反射，setDriverClassName,给当前类的对象赋值，所以，属性名称很重要
public class JdbcProperties {

    private String driverClassName;

    private String url;

    private String username;

    private String password;

    private Set<String> girls = new HashSet<>();

    public Set<String> getGirls() {
        return girls;
    }

    public void setGirls(Set<String> girls) {
        this.girls = girls;
    }

    private Xxx user = new Xxx(); //常规属性，例如String,long等不需要自己初始化，但是碰到非普通属性，一定要自己手动初始化

    public class Xxx{
        private String name;

        private Integer age;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Integer getAge() {
            return age;
        }

        public void setAge(Integer age) {
            this.age = age;
        }
    }

    public Xxx getUser() {
        return user;
    }

    public void setUser(Xxx user) {
        this.user = user;
    }

    public String getDriverClassName() {
        return driverClassName;
    }

    public void setDriverClassName(String driverClassName) {
        this.driverClassName = driverClassName;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
